<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>解构赋值</title>
</head>
<body>
<p>解构:把整体拆分成组件</p>
<script>
    //传统的赋值
    var a = 1, b = 2, c = 3;
    console.log(a, b, c);
    //数组的解构赋值
    var [x, y, z] = [4, 5, 6];
    console.log(x, y, z);
    //对象的赋值
    var user = {name: "孟云鹏", age: 24, address: "郑州"};
    var username = user.name;
    var userage = user.age;
    var useraddr = user.address;
    console.log(username, userage, useraddr);
    //对象的解构赋值
    var {name, age, address} = user;
    console.log(name,age,address);
</script>
</body>
</html>